package com;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

public class Test09 {
    public static void main(String[] args) throws IOException {
        String path = "HomeWork15\\dir\\学生.txt";

        ArrayList<Student> array = new ArrayList<>();

        BufferedReader br = new BufferedReader(new FileReader(path));
        String line;
        while ((line = br.readLine()) != null) {
            String[] strArray = line.split(",");

            Student stu = new Student();
            stu.setName(strArray[0]);
            stu.setAge(Integer.parseInt(strArray[1]));
            stu.setGender(strArray[2]);

            array.add(stu);
        }
        br.close();

        array.forEach(stu -> System.out.println(stu));
    }
}
